import { BoolStrWithBoolen } from '../../Utils/common'
export function personalHistory(data) {
  const {
    attr109,
    attr110,
    attr111,
    attr112,
    attr113,
    attr114,
    attr115,
    attr116,
    attr117,
    attr118,
    attr119,
    attr120,
    attr121,
    attr236,
  } = data
  let str = ''
  if (attr109) str += `第${attr109}产`
  if (str && attr110Convert(attr110)) str += `(${attr110Convert(attr110)})，`
  str += `${BoolStrWithBoolen(attr111) ? '有' : '无'}产伤，`
  str += `${BoolStrWithBoolen(attr112) ? '有' : '无'}窒息，`

  str += attr113to114and236Convert(attr113, attr114, attr236)
  str += `，${BoolStrWithBoolen(attr115) ? '有' : '没有'}按时添加辅食，`
  str += `，${BoolStrWithBoolen(attr116) ? '有' : '没有'}偏食，`
  str += `。生长发育史：讲话、走路、上学方面${
    BoolStrWithBoolen(attr117) ? '有' : '没有'
  }特殊，`
  if (attr118) str += `生长发育史(${attr118})，`
  str += `，${BoolStrWithBoolen(attr119) ? '有' : '没有'}按时打预防针，`
  str += `，${BoolStrWithBoolen(attr120) ? '有' : '没有'}不良反应，`
  if (attr121) str += `不良反应(${attr121})`

  str += '。'
  return str
}
function attr110Convert(str = '') {
  const b1 = str.includes('顺产')
  const b2 = str.includes('剖宫产')
  const b3 = str.includes('早产')
  if (b1 && b2 && !b3) {
    return '顺转剖'
  } else if (b1 && b2 && b3) {
    return '顺转剖，早产'
  } else if (b1 && !b2 && b3) {
    return '顺产，早产'
  } else if (!b1 && b2 && b3) {
    return '剖宫产，早产'
  }
  return str
}
function attr113to114and236Convert(attr113, attr114, attr236) {
  if (attr113 && attr114) {
    return `，${attr113}(至${attr114}月龄)`
  } else if (attr113 && attr236) {
    return `，${attr113}(从${attr236}月龄开始添加辅食) `
  } else if (attr113) {
    return `，${attr113}`
  }
  return ''
}
